package com.unknownman.block.service.impl;

import com.unknownman.block.entity.TNftTransRecord;
import com.unknownman.block.mapper.TNftTransRecordMapper;
import com.unknownman.block.service.TNftTransRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lianziyou.chain.common.api.CommonPage;
import com.github.pagehelper.PageHelper;
import org.springframework.util.StringUtils;
import java.util.List;

/**
* <p>
    * NFT转账记录表，根据链的区块来扫描。 服务实现类
    * </p>
*
* @author xhy
* @since 2021-10-20
*/
@Service
public class TNftTransRecordServiceImpl extends ServiceImpl<TNftTransRecordMapper, TNftTransRecord> implements TNftTransRecordService {

    @Override
    public  CommonPage<TNftTransRecord> findListByPage(Integer page, Integer limit, String orderBy, QueryWrapper<TNftTransRecord> queryWrapper){
        if (StringUtils.isEmpty(orderBy)){
            PageHelper.startPage(page, limit);
        }else {
            PageHelper.startPage(page, limit, orderBy);
        }
        List<TNftTransRecord> list = baseMapper.selectList(queryWrapper);
        return CommonPage.restPage(list);
    }
}
